import React from 'react';
import ReactDOM from 'react-dom/client';
import { Provider } from 'react-redux';
import store from './store';
import './styles/index.js';
import App from './App';
import zhCN from 'antd/lib/locale/zh_CN';
import { ConfigProvider } from 'antd';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <Provider store={store}>
      <ConfigProvider locale={zhCN}>
        <App />
      </ConfigProvider>
    </Provider>
  </React.StrictMode>
);

function envHook(envs) {
  Object.entries(envs || {})
    .filter(([key]) => key.startsWith('REACT_APP'))
    .forEach(([key, value]) => {
      const comment = document.createComment(` ${key}(${value}) `);
      document.insertBefore(comment, document.documentElement);
    });
}
envHook(process.env);
